#!/usr/bin/python
# coding=utf-8

import plotly.plotly
import random
from plotly.graph_objs import *
import plotly.graph_objs as abc  # 必须


def sayHello():
    listx = []
    for i in range(20):
        listx.append(i)
    print listx
    listxx = listx
    listy = []
    for i in range(20):
        listy.append(random.randint(12, 20))
    # print listy
    listyy = []
    for i in range(20):
        listyy.append(random.randint(12, 20))
    # print listy
    data_1 = abc.Scatter(
            x=listx,
            y=listy,
            name='test1'
    )
    date_2 = abc.Scatter(
            x=listxx,
            y=listyy
    )
    data1 = Data([data_1, date_2])
    plotly.offline.plot(data1)


if __name__ == "__main__":
    # sayHello()
    # z = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
    # a = []
    # matrix = [[zij for zij in zi] for zi in z]
    # for i, j in zip(range(300, 800), range(1, 100)):
    #     print i
    #     print j
    print'\n'.join([''.join( [('Love'[(x - y) % 4] if ((x * 0.05) ** 2 + (y * 0.1) ** 2 - 1) ** 3 - (x * 0.05) ** 2 * (y * 0.1) ** 3 <= 0 else ' ') for x in range(-30, 30)]) for y in range(15, -15, -1)])

    for y in range(15, -15, -1):
        line = []
        for x in range(-30, 30):
            if ((x * 0.05) ** 2 + (y * 0.1) ** 2 - 1) ** 3 - (x * 0.05) ** 2 * (y * 0.1) ** 3 <= 0:
                line.append('Love'[(x - y) % 4])
            else:
                line.append(" ")
        l = "".join(line)
        print l

    print('\n'.join([' '.join(['%s*%s=%-2s' % (y, x, x * y) for y in range(1, x + 1)]) for x in range(1, 10)]))

    print(
        ' '.join(
                [str(item) for item in filter(
                        lambda x: not [
                            x % i for i in range(2, x) if x % i == 0
                            ], range(2, 10)
                )]
        ))

    ss = range(2, 10)
    i = 0
    print ss

    # def test(x):
    #     i += 1
    #     return x % ss[i] == 0
    # filter1 = filter(test, ss)
    print ss
    f = lambda x: [x % i for i in range(2, x) if x % i == 0]
    d = f(5)
    print d
    print not d
